<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>求红白黑球的个数</title>
</head>
<body>
<script>
    var RedWhite = 25;
    var WhiteBlack = 31;
    var RedBlack = 28;

    for (var Red = 0; Red <= RedWhite; Red++) {
        for (var White = 0; White <= RedWhite; White++) {
            for (var Black = 0; Black <= RedWhite; Black++) {
                if (Red + White === RedWhite &&
                    White + Black === WhiteBlack &&
                    Red + Black === RedBlack) {
                    alert(("红球个数：" + Red + "<br>") +
                    ("白球个数：" + White + "<br>") +
                        ("黑球个数：" + Black + "<br>"));
                }
            }
        }
    }
</script>
</body>
</html>